<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
  <head>
    <title>Example</title>
    
    <style type="text/css">
      table {
        border: 1px solid #dcdcdc;
        border-collapse: collapse;
      }
      
      th, td {
        border: 1px solid #dcdcdc;
        padding: 5px;
      }
      
      thead {
        background-color: #f4f4f4;
      }
    </style>
  </head>

  <body>
    <h1>Test Forum</h1>
    
    <h3>Thread: ${thread.title}</h3>
    
    <form action="createPost.html" method="post">
      <div>
        <label for="title">Title:</label>
        <input name="title" type="text" />
      </div>
      
      <div>
        <label for="author">Author:</label>
        <input name="author" type="text" />
      </div>
      
      <div>
        <label for="content">Content:</label>
        <textarea name="content"></textarea>
      </div>
      
      <input name="threadId" type="hidden" value="${thread.threadId}" />
       
      <input type="submit" value="Store" />
    </form>
    
    <div>
      <a href="forum.html">Back to forum</a>
    </div>
    
    <c:forEach items="${thread.posts}" var="post">
      <table style="margin: 5px 0; width: 100%;">
        <tr style="background-color: #d2d2d2;">
          <td width="10%;">${post.date}</td>
          <td>${post.title}</td>
        <tr>
        <tr>
          <td>${post.author}</td>
          <td>${post.content}</td>
        </tr>
      </table>
    </c:forEach>
    
  </body>
</html>
